<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html >
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/Yhmain.css" rel="stylesheet" type="text/css">
<link href="css/top.css" rel="stylesheet" type="text/css">
<link href="css/home.css" rel="stylesheet" type="text/css">
<link href="css/pl.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="css/window.css" />
<link rel="stylesheet" href="font-awesome-4.6.3/css/font-awesome.min.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>

<script src="js/bqb.js"></script> 
<script src="js/window.js"></script>
<script>

</script>
<title>智行校园-精准化服务平台</title>
</head>
<body class="background">
<div class="container" style="margin-top: 1em;" >
 <input type="hidden" value="目标广场"  />
	<div class=" " >
		<div class="col-Fill-7 text-left">
				<a class="font-size-h3" style="display:inline-block;font-size: 1.3em;line-height: 1.5;">目标广场</a>
			<form class="in-block float-r">
		
			        <input class="line-h-32 search_input"  placeholder="请输入目标名称等关键字" style="width:23.75em;height:2.0em; "/>
			        <input type="button" class="btn border-rad5 line-h-32 search_input_button" style="width:5.625em;" value="搜索" />
			</form>
		</div>
		<div class="col-Fill-3">
		</div>
		<div class="clear-b"></div>
	</div>
	<div  >
		<div class="col-Fill-7 text-left">
	        <div class=" mt20">
	           <div class="clear-b" id="the_share_square"></div>
	            <div class="loaddiv" style="display:none;height:2em;text-align: center;width: 100%;">  
                      <img src="img/loading.gif"  height="100%" style="width:2em;margin-right:1em"/> 正在加载。。。
                 </div> 
            </div>
        </div>
		<div class="col-Fill-3">
			<div class="mt20 bg-color-white text-center pt20 border-all" id="btn">
				<div class="header-photo1 bg-color-qyellow to-center mb10">
					<img alt="" src="" id="user_img" width="100%" height="100%">
				</div>
				<div  class="the_user_name">
					李逍遥
				</div>
				<ul>
					<li class="border-r"><a href="html/personal_center/share.jsp">我的分享(0)</a></li>
					<li><a href="html/personal_center/point_notes.jsp">我的积分(0)</a></li>
					<div class="clear-b"></div>
			    </ul>
			</div>
			<div class="bg-color-white mt20  hot_targets" style="border:1px solid #b7b6b6">
				<div class="border-b pt10 pb10">
					<img src="img/mbgc_01.png" style="width:18px;height:18px;padding-left:10px;"/>
					<a class="in-block header-Hammer-center"><span class="ml10 mt2 in-block">热门加入目标</span></a>
				</div>
				<div class="clear-b"></div>
			</div>
			<div class="bg-color-white mt20 focus_targets" style="border:1px solid #b7b6b6">
				<div class="border-b pt10 pb10">
					<img src="img/mbgc_03.png" style="width:18px;height:18px;padding-left:10px;"/>
					<a class="in-block header-Hammer-center"><span class="ml10 mt2 in-block">最受关注的目标</span></a>
				</div>
				<div class="clear-b"></div> 
			</div>
		</div>
	    <div class="clear-b"></div>
    </div>
    <div class="clear-b"></div>
 </div>
<form method="post"  name="userid_form" >
	    <input type="hidden" value="" name="userid" />
    </form>
     
 <div id="review_dialog" style="display:none;" class="table_dialog">
	   <div class="dialog"></div>
	    <div class="my_dialog" style="top:30%;left:30%;position:fixed;width:25em" id="review_set">
	        <h4 style="color:#333">举报</h4><i class="fa fa-times" style="color:#b7b6b6"></i>
	        <div class="target_dialog" style="padding: 0.8em 2em;background:white">
					  <label><img src="img/report.png" >您为什么要举报此分享？</label>
					  <ul>
					   <li>
					      <label for="report_input_1">
					       <input type="radio" id="report_input_1" name="report_input" value="骚扰谩骂"/>骚扰谩骂  
					      </label>  
					   </li>
					   <li>
					      <label for="report_input_2">
					        <input type="radio"  id="report_input_2" name="report_input" value="广告欺诈" />广告欺诈  
					      </label>
					   </li>
					   <li>
					      <label for="report_input_3">
                            <input type="radio" id="report_input_3"  name="report_input" value="色情暴力" />色情暴力   
                          </label>
					   </li>
					   <li>
					      <label for="report_input_4">
					        <input type="radio"  id="report_input_4" name="report_input" value="病毒木马"  />病毒木马
					      </label>
					   </li>
					   <li>
					      <label for="report_input_5">
					         <input type="radio"  id="report_input_5" name="report_input" value="反动政治"  />反动政治
					      </label>
					   </li>
					   <li>
					      <label for="report_input_6">
					         <input type="radio" id="report_input_6"  name="report_input" value="其他"  />其他
					       </label>
					   </li>
					  </ul>
					 <label>举报说明 （可选）</label>
					 <input type="text" style="font-size:0.8em" placeholder="描述恶意行为" />
					 <label style="width:13em;float:left;display:none"><i class="sp-error"></i>您必须选择一项才能提交</label>
				     <button class="make_sure do_it" style="border:1px solid #0084d4">提交</button>
				     <button class="make_sure cancle_it" style="background:#f1f1f1;color:#333;border:1px solid #b7b6b6" >取消</button>
				<div  class="clear"></div>
	        </div>
	    </div>
	</div>
<script type="text/javascript" src="js/top.js"></script>
<script>
var page = 1;
var gPageSize = 10; 
var total_share_targets;
var user_id = '<%=session.getAttribute("userid")%>';
var user_name = '<%=session.getAttribute("username")%>';
var faceaddress = '<%=session.getAttribute("faceaddress")%>';
var ticket = '<%=session.getAttribute("ticket")%>';

$('body').append(' <input id="user_id" style="display:none" value="'+user_id+'"  />');
$('form[name="userid_form"] input:hidden').attr('value',user_id);
var user_img='';

$.getJSON('/WDDXSERVER/targetsquare/getShareNumber',{userid:user_id,ticket:ticket},function(data){
	data = data[0].content.message[0];
	total_share_targets=data.tatal;
	user_img=data.url;
	user_name=data.name;
	$('#user_img').attr('src',data.url);
	$('div#btn div.the_user_name').text(data.name);
	$('div#btn ul li:eq(0) a').text('我的分享 （'+data.count+'）');
	$('div#btn ul li:eq(1) a').text('我的积分 （'+data.number+'）');
	 hot_and_focus('hot_targets','/WDDXSERVER/targetsquare/getHotTarget?ticket='+ticket+'&userid='+user_id);
	 hot_and_focus('focus_targets','/WDDXSERVER/targetsquare/getMostFollow?ticket='+ticket+'&userid='+user_id);
	 my_square("/WDDXSERVER/targetsquare/getShareInfo",{userid:user_id,cxtj:'',pageSize:gPageSize,pagenum:page,ticket:ticket});
});

$('input.search_input_button').click(function(){
	   $('div#the_share_square').empty();
	   page=1;
	   my_square('/WDDXSERVER/targetsquare/getShareInfo',{userid:user_id,cxtj:encodeURI($(this).prev().val()),pageSize:gPageSize,pagenum:page,ticket:ticket});
	   
});
function get_comments(s_id){
	//跨域取数据
	$.getJSON("/WDDXSERVER/targetsquare/getComment?userid="+user_id+"&s_id="+s_id+'&ticket='+ticket,function(data,status,xhr){

		var dom = $('#pllb_'+s_id);
	//绑定数据
		var htmlroot = null;
		data = data.content.message;
		$.each(data,function(index,rec){
		if(rec["bjzd"] == 0){
		   var Reply= rec["a_content"];
		   	dom.append(htmlroot);	
			htmlroot = null;
			htmlroot = '<div class="text-left mb10" style="font-size:10px;">'+
		                		'<div class="float-l" style="width:29px;height:29px;"><img src='+rec["faceaddress"]+' width=100%>'+'</div>'+
		                		'<div class="float-l ml10" style="width:90%;">'+
		                			'<div>'+
			                			'<div class="ml3">'+'<a href="#" data-id="'+rec["com_id"]+'" data-comment="'+rec["a_id"]+'">'+rec["a_answer_name"]+'</a>'+"："+Reply+'</div>'+
			                			'<div class="color-gary ">'+rec["a_date"]+
			                				'<a name="p1" href="javascript:;" class="ml10">'+'<img src="img/mbgc_12.png" height="13px">'+'</a>';
			                	if(rec["operate"]==1)
			                		htmlroot+='<a class="comment_delete"></a></div>';
			                    else
			                    	htmlroot+='</div>';	
			                    
			                    	htmlroot+='<div class="Input_Box1" style="display:none;" name="annex-pl">'+
			                			'<div contenteditable="true" class="Input_text" name="textpl"></div>'+
										      '<div >'+
										      	 '<div class="faceDiv">'+'</div>'+
										      	 '<div class="Input_Foot">'+'<a onmouseover="onmous(this)" onmouseout="onmousout(this)" class="imgBtnPC" name="imgBtnPC1" href="javascript:void(0);">'+'</a>'+'<a class="postBtn" onmouseover="onmous(this)" onmouseout="onmousout(this)" name="postBTN1">'+"确定"+'</a>'+'</div>'+
										      '</div>'+
									    '</div>'+
		                			'</div>'+
		                		/* 	二级评论 */
		                		'<div>'+
		                				'<span name="mypl" class="clear-b">'+'</span>'+
		                		'</div>'+
		                		'</div>'+
		                		'<div class="clear-b">'+'</div>'+
		                	'</div>'
		}else{
			var a = htmlroot.split('<span name="mypl" class="clear-b">'+'</span>');
			var html = '<div class="pt5">'+
		                				'<div class="float-l" style="width:29px;height:29px;">'+'<img src='+rec["faceaddress"]+' width=100%>'+'</div>'+
			                				'<div class="float-l ml10" style="width:90%;">'+
			                				'<div class="ml3 text-left">'+'<a href="#" data-comment="'+rec["a_id"]+'" >'+rec["a_answer_name"]+'</a>'+'<span class="color-black">'+"：回复		"+'<span>'+'<a href="#">'+rec["a_be_answer_name"]+'</a>'+"："+rec["a_content"]+'</div>'+
			                			    '<div class="color-gary">'+rec["a_date"]+'<a name="p1" href="javascript:;" class="ml10">'+'<img src="img/mbgc_12.png" height="13px">'+'</a>';
			                			    if(rec["operate"]==1)
			                			    	html+='<a class="comment_delete"></a></div>';
						                    else
						                    	html+='</div>';	
			               
			                				html+='<div class="Input_Box1" style="display:none;" name="annex-pl">'+
											      '<div contenteditable="true" class="Input_text" name="textpl"></div>'+
											      '<div >'+
											      	 '<div class="faceDiv">'+'</div>'+
											      	 '<div class="Input_Foot">'+'<a onmouseover="onmous(this)" onmouseout="onmousout(this)" class="imgBtnPC" name="imgBtnPC1" href="javascript:void(0);">'+'</a>'+'<a class="postBtn" onmouseover="onmous(this)" onmouseout="onmousout(this)" name="postBTN1">'+"确定"+'</a>'+'</div>'+
											      '</div>'+
									    	' </div>'+
			                			'</div>'+
			                			'<div class="clear-b">'+'</div>'+
		                			'</div>'
		     htmlroot=a[0]+html+'<span name="mypl" class="clear-b">'+'</span>'+a[1];
		}
		
				
		});
		dom.append(htmlroot);
		comment_control(s_id)
	});
	
};
function getNowFormatDate() {
    var date = new Date();
    var seperator1 = "-";
    var seperator2 = ":";
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
            + " " + date.getHours() + seperator2 + date.getMinutes()
            + seperator2 + date.getSeconds();
    return currentdate;
} 
function comment_control(s_id){
	  $("a[name=p1]").unbind('click').bind('click',function(){
		 var s_id=$(this).parents('div[name=onejl]').attr('data-id');
		 $('#pllb_'+s_id).parent().find('div[class*=Input_Box]').css("display","none");
		 $(this).parent().next().css("display","block");
		 $(this).parent().next().find('div[name=textpl]').focus();
	});
	  $("a.comment_delete").unbind('click').bind('click',function(){
		  var the_comment='';
		  //回复id；
		  the_comment=$(this).parent().prev().find('a').attr('data-comment');
		  //分享id
		  var the_s_id=$(this).parents('div[name=onejl]').attr('data-id');
			if($(this).parent().parent().parent().attr('class')=='pt5'){
				var the_reply=$(this).parents('div.pt5').parent().prev().children('div.ml3').find('a').attr('data-id');
				$(this).parents('div.pt5').remove();
				$.getJSON("/WDDXSERVER/targetsquare/deleteReply",{userid:user_id,ticket:ticket,s_id:the_s_id,com_id:the_reply,a_id:the_comment},function(data,status,xhr){
				});
				}
			else{ 
				var the_reply=$(this).parents('div.color-gary').prev().find('a').attr('data-id');
			
				$(this).parent().parent().parent().parent().remove();
				$.getJSON("/WDDXSERVER/targetsquare/deleteComments",{userid:user_id,ticket:ticket,s_id:the_s_id,com_id:the_reply},function(data,status,xhr){
					
				});	
			}
		});
	$('div[name=annex-pl] div.Input_text').bind('blur',function(){
		$(this).focus();
		if(!$('a[name=postBTN1]').hasClass("active") && !$('a[name=imgBtnPC1]').hasClass("active") && !$('img').hasClass("active")){
			$(this).parent().css("display","none");
			$('div[name=main-pl]').css("display","block");
			$('div[name=main-pl] div.Input_text').css("height","20px");
		}
	});
	//绑定表情包
		ImgIputHandler.Init();
		$(".postBtn").click(function(){
		//	$(this).parent().parent().prev().focus();
			var the_comment=$(this).parent().parent().prev().html();
		    var the_s_id=$(this).parents('div[name=onejl]').attr('data-id');
		    var $the_dom='';
		    if(the_comment!=''){
			if(typeof($(this).parent().parent().attr('id'))=='undefined'){
				var the_a_id=$(this).parents('.Input_Box1').prev().prev().find('a:eq(0)').attr('data-comment');
				var a_name=$(this).parents('.Input_Box1').prev().prev().find('a:eq(0)').text();
				if($(this).parents('div.pt5').length==0){
					$the_dom=$(this).parents('div.Input_Box1').parent().next();
				}
				else
				 $the_dom=$(this).parents('div.pt5').parent();
				paint_comment($the_dom,'1',"/WDDXSERVER/targetsquare/answer",{userid:user_id,ticket:ticket,s_id:the_s_id,a_id:the_a_id,content:encodeURI(the_comment)},a_name);
			
			}
			else{
				 $the_dom=$(this).parents('div.Input_Box').prev();
				paint_comment($the_dom,'0',"/WDDXSERVER/targetsquare/comment",{userid:user_id,ticket:ticket,s_id:the_s_id,content:encodeURI(the_comment)},'');
				
			}}
			
			$(this).parent().parent().prev().html('');
			$(this).parent().parent().prev().parent().css('display','none');
			$('div[name=main-pl]').css({'display':'block','height':'30px'});
			$('div[name=main-pl]').find('div.Input_text').css({'height':'20px'});
		});
	
};
function paint_comment(id,sign,url,param,a_name){
	$.getJSON(url,param,function(data){
		var html='';
		if(data.message=='成功'){
		data =data.content.message;
		if(sign=='1'){
		html+='<div class="pt5">'+
			'<div class="float-l" style="width:29px;height:29px;">'+'<img src='+user_img+' width=100%>'+'</div>'+
				'<div class="float-l ml10" style="width:90%;">'+
				'<div class="ml3 text-left">'+'<a href="#" data-id="'+data.com_id+'" data-comment="'+data.a_id+'" >'+user_name+'</a>'+'<span class="color-black">'+"：回复		"+'<span>'+'<a href="#">'+a_name+'</a>'+"："+decodeURI(param.content)+'</div>'+
			    '<div class="color-gary">'+data.time+'<a name="p1" href="javascript:;" class="ml10">'+'<img src="img/mbgc_12.png" height="13px">'+'</a><a class="comment_delete"></a>'+'</div>'+
				 '<div class="Input_Box1" style="display:none;" name="annex-pl">'+
				      '<div contenteditable="true" class="Input_text" name="textpl"></div>'+
				      '<div >'+
				      	 '<div class="faceDiv">'+'</div>'+
				      	 '<div class="Input_Foot">'+'<a onmouseover="onmous(this)" onmouseout="onmousout(this)" class="imgBtnPC" name="imgBtnPC1" href="javascript:void(0);">'+'</a>'+'<a class="postBtn" onmouseover="onmous(this)" onmouseout="onmousout(this)" name="postBTN1">'+"确定"+'</a>'+'</div>'+
				      '</div>'+
		    	' </div>'+
			'</div>'+
			'<div class="clear-b">'+'</div>'+
		'</div>';

		}else{
			html+='<div class="text-left mb10" style="font-size:10px;">'+
			'<div class="float-l" style="width:29px;height:29px;"><img src='+user_img+' width=100%>'+'</div>'+
			'<div class="float-l ml10" style="width:90%;">'+
				'<div>'+
	    			'<div class="ml3">'+'<a href="#" data-id="'+data.com_id+'" data-comment="'+data.a_id+'">'+user_name+'</a>'+"："+decodeURI(param.content)+'</div>'+
	    			'<div class="color-gary ">'+data.time+
	    				'<a name="p1" href="javascript:;" class="ml10">'+'<img src="img/mbgc_12.png" height="13px">'+'</a><a class="comment_delete"></a>'+
	    			'</div>'+
	    			'<div class="Input_Box1" style="display:none;" name="annex-pl">'+
	    			'<div contenteditable="true" class="Input_text" name="textpl"></div>'+
					      '<div >'+
					      	 '<div class="faceDiv">'+'</div>'+
					      	 '<div class="Input_Foot">'+'<a onmouseover="onmous(this)" onmouseout="onmousout(this)" class="imgBtnPC" name="imgBtnPC1" href="javascript:void(0);">'+'</a>'+'<a class="postBtn" onmouseover="onmous(this)" onmouseout="onmousout(this)" name="postBTN1">'+"确定"+'</a>'+'</div>'+
					      '</div>'+
				    '</div>'+
				'</div>'+
			/* 	二级评论 */
			'<div>'+
					'<span name="mypl" class="clear-b">'+'</span>'+
			'</div>'+
			'</div>'+
			'<div class="clear-b">'+'</div>'+
		'</div>';
		}
		id.append(html);
		comment_control(param.param1);
		}
		else
			win.alert("系统通知","评论失败！");
	});
};
//获取滚动条当前的位置
function getScrollTop() {
   var scrollTop = 0;
   if (document.documentElement && document.documentElement.scrollTop) {
        scrollTop = document.documentElement.scrollTop;
       }
   else if (document.body) {
        scrollTop = document.body.scrollTop;
      }
   return scrollTop;
 }

//获取当前可是范围的高度
function getClientHeight() {
   var clientHeight = 0;
   if (document.body.clientHeight && document.documentElement.clientHeight) {
    clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight);
    }
   else {
    clientHeight = Math.max(document.body.clientHeight, document.documentElement.clientHeight);
    }
    return clientHeight;
}

//获取文档完整的高度
function getScrollHeight() {
    return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
} 
window.onscroll = function(){ 
   var the_length=$('div#the_share_square div[name=onejl]').length;
   if(0<(parseInt(total_share_targets)-parseInt(the_length))){
	if (getScrollTop() + getClientHeight() == getScrollHeight()) {
		my_square("/WDDXSERVER/targetsquare/getShareInfo",{userid:user_id,cxtj:'',pageSize:gPageSize,pagenum:page,ticket:ticket});	
	 } 
    }
   else{

	   $('div.loaddiv').hide();
   }
}; 

function hot_and_focus(id,url){
	$.getJSON(url,function(data,status,xhr){
		data = data.content.message;
		var str='';
		for(var h=0;h<data.length;h++)
		  str+='<dl  class="hover_object"><dt>'+data[h].t_name+'</dt><dd class="word-overflow">'+data[h].t_describe+'</dd>'+
		    '<div class="clear-b"></div></dl><dl style="height:100px" class="the_hover_object">'+
	        '<dt class="height100"><img src="'+data[h].icon+'"  ></dt>'+
	        '<dd class="height100"><b class="block" >'+data[h].t_name+'</b><a class="mt10 block text-left pl10 ">'+data[h].t_describe+'</a></dd>'+
	        '<div class="clear-b"></div></dl>';
	      $('div.'+id+' div.clear-b').before(str);
	   /*   $('dd.word-overflow').unbind('mouseover').mouseover(function(){
			  var $the_detial=$(this).parent().next();
			  var the_height=$the_detial.outerHeight()/2;
			  $the_detial.find('img').css('margin-top','calc( '+ the_height +'px - 2.2em)');
			  $(this).parent().hide('fast').next().show('slow').delay(5000).hide('slow').prev().delay(5002).show('slow');
			 
			});*/
			$('div.hot_targets').on('click ','dl.hover_object',function(event){
				  var $this=$(this);
				  var $the_detial=$this.next();
				  var the_height=$the_detial.outerHeight()/2;
				  $the_detial.find('img').css('margin-top','calc( '+ the_height +'px + 0.5em)');
				  $the_detial.show('slow');
				  $this.hide();
				  setTimeout(function(){
					  $the_detial.hide('fast');
					  $this.show('slow');
				  },5000);
				  event.stopPropagation();
			 });
		
	});
}
function my_square(url,param){
	page++;
$.getJSON(url,param,function(data,status,xhr){
	 $(".loaddiv").show();  
	 data = data.content.message;
	 var len = data.length;
	if(status=='success'&& len>0){
	 
	  for(var i=0;i<len;i++){
		  var the_status='';
		  var the_operate='';
		  if(data[i].state=='0')
			  the_status='点赞';
		  else
			  the_status='取消赞'	; 
		  if(data[i].operate=='1')
			  the_operate='加入我的目标';
		  else
			  the_operate='已加入日常目标'	; 
		  var str='';
		 str+='<div name="onejl" data-id="'+data[i].id+'" data-target="'+data[i].t_id+'">'+
		  '<div style="border:1px #cbc7c7 solid;" class="pl20 pt20">'+
		  	'<div><div class="header-photo bg-color-gray float-l" >'+
		  	   '<img  src="'+data[i].path+'" width="100%" height="100%"/></div>'+
		  		'<div class="float-l pt10 ml10 text-left">'+
		  			'<a class="font-size-h3">'+data[i].s_user+'</a>'+
		  			'<div class="in-block pt20 color-gray-word" style="font-size:14px;">'+
		  			  data[i].s_date+'<span class="ml20">'+data[i].mbtype+
		  			 '</span><a href="#"><img src="img/liulan_03.png" alt="" class="ml20" height="14px;"/></a><a style="margin-left:4px;">浏览   ('+data[i].browse+')</a></div>'+
		  		'</div></div><div class="pt10 clear-b text-left"><a>'+data[i].title+'</a></div>'+
		  	   '<div class="text-left md20 border-all pd10 bg-color-qyellow"><div style="font-size:18px;">'+data[i].mbtitle+'</div>'+
		  		'<a class="block pt10">描述：'+data[i].ms+'</a><a class="block pt10 color-blue" href="javascript:" name="showAll">展开全部</a>'+
		  		'<div class="pt10" ><a class="block float-l pr10">展开任务分解</a><img name="qh" src="img/sanjiao_03.png" height="19px;" style="float:left;"/><div class="clear-b"></div></div>'+
		  		'<table name="table_'+data[i].id+'" class="mt20 my-table " width="100%">'+
		  		'<tbody><tr><td>序号</td><td>描述</td><td>相关资料</td><td>签到次数</td></tr></tbody></table></div><div class="clear-b"></div></div>'+
		          '<div class="text-left border-l border-r" ><a class="block border-r pd10-plr20 float-l" name="pinglun" href="#"><div class="float-l" style="width:25px;height:25px;">'+
		  	      '<img src="img/mbgc_05.png" height=100%/></div><div class="float-l color-blue" style="line-height:25px;margin-left:0.4em"><span>'+the_operate+'</span></div></a>'+
		  	    '<a class="block border-r pd10-plr20 float-l" /* name="pinglun" href="div[name=main-pl] */"><div class="float-l" style="width:25px;height:25px;">'+
		  	    '<img src="img/pinlun_03.png" height=100%/></div><div class="float-l color-blue" style="line-height:25px;margin-left:0.4em"><span>评论</span></div></a>'+
		  	    '<a class="block border-r pd10-plr20 float-l"  name="pinglun" href="#" ><div class="float-l" style="width:25px;height:25px;"><img src="img/dianzan_03.png" height=100%/>'+
		  		'</div><div class="float-l color-blue" style="line-height:25px;margin-left:0.4em"><span name="dianzan" data-operate="'+data[i].state+'">'+the_status+'('+data[i].zan+')</span></div></a>'+
		  	    '<div class="block border-r float-l"  style="height:41px;width:79px;" >'+
		  		 '<div style="line-height:30px;position:absolute;text-align:center;width:80px;" ><a href="javascript:;" name="menubt" style="height:41px;display:block;">...</a>'+
		  		    '<ul style="position:relative;left:0;width:100%;display:none;"><li><a href="javascript:;">隐藏</a></li><li><a href="javascript:;">举报</a></li>'+
		  			'</ul></div></div><div class="clear-b"></div> </div><div class="pd20 border-all bg-color-qyellow text-right" style="padding-top:0px;">'+
		  			'<div class="text-left mb10 mt10 dianzan_object" name="dianzan_object_'+data[i].id+'"><img src="img/mbgc_11.png" class="zan_sign" ></div>'+
		             '<div id="pllb_'+data[i].id+'" style="margin-top:0.5em"></div> <div class="Input_Box" name="main-pl"> <div contenteditable="true" class="Input_text"></div><div style="display:none;" id="btnpl">'+
		  	      	 '<div class="faceDiv"> </div>'+
		  	      	 '<div class="Input_Foot"> <a onmouseover="onmous1(this)" onmouseout="onmousout1(this)" class="imgBtnPC" href="javascript:void(0);"></a><a class="postBtn" onmouseover="onmous1(this)" onmouseout="onmousout1(this)">确定</a> </div></div></div></div></div>';
		  	      	 $('div#the_share_square').append(str);
		  	      	 for(var j=0;j<data[i].table.length;j++)
		  	          	$('table[name="table_'+data[i].id+'"] tbody').append('<tr><td>'+data[i].table[j].c_id+'</td><td>'+data[i].table[j].c_name+'</td><td>'+data[i].table[j].c_resource+'</td><td>'+data[i].table[j].c_daynum+'</td></tr>');
		  	      	 $('a[name=showAll]').unbind('click').bind('click',function(){
		  	  		   var url1 = "img/sanjiao_01.png";
		  	  		   var url2 = "img/sanjiao_03.png";
		  	  		   if($('table').css("display")=="none"){
		  	  			 $('img[name=qh]').attr("src",url2); 
		  	  		   }else{
		  	  		 	$('img[name=qh]').attr("src",url1);  
		  	  		    }
		  	  		     $(this).siblings('table').toggle();
		  	         });
		  	      	$(' a[name="menubt"]').unbind(' click').bind('click',function(){
		  	      		var the_share_id=$(this).parents('div[name=onejl]').attr('data-id');
		  				$(this).next().toggle();
		  				$(this).next().find('li:eq(0)').click(function(){
		  					 $(this).parent().hide('fast');
		  					$(this).parents('div[name=onejl]').hide('slow');
		  				   
		  				});
		  				$(this).next().find('li:eq(1)').click(function(){
		  					$('div#review_dialog input[type="text"]').val('');
		  					$('div#review_dialog ').show('fast');
		  					$(this).parent().hide('fast');
		  					$('div#review_dialog i.fa-times,div#review_dialog button.cancle_it').click(function(){
		  						$('div#review_dialog ').hide('fast');
		  					});
		  					$('div#review_dialog input[name=report_input]').change(function(){
		  						  $('div#review_dialog button.do_it').prev().hide('fast');
		  					});
		  					$('div#review_dialog button.do_it').click(function(){
		  						var the_report_reason1=encodeURI($('div#review_dialog input[name="report_input"]:checked').attr('value'));
		  						var the_report_reason2='';
		  						the_report_reason2=encodeURI($('div#review_dialog input[type="text"]').val());
		  						if(typeof(the_report_reason1)=='undefined')
		  							$(this).prev().show('fast');
		  						else{
		  							$(this).prev().hide('fast');
		  							$.getJSON("/WDDXSERVER/targetsquare/whistle_blowing",{ticket:ticket,userid:user_id,s_id:the_share_id,content:the_report_reason1,describe:the_report_reason2},function(data){
		  								if(data.message=='成功'){
		  									 win.alert("系统通知","举报成功，我们会以消息方式提醒您处理结果。");
				  							 $('div#review_dialog ').hide('fast');
		  								}
		  							});
		  						   
		  						}
		  					});
		  				});
		  	     	});
		  	       $('div[name=main-pl] div.Input_text').unbind('blur').bind('blur',function(){
		  	    	  
			  			if(!$(this).parent().find('.postBtn').hasClass("active1")&&!$(this).parent().find('.imgBtnPC').hasClass("active1") && !$(this).parent().find('img').hasClass("active")){
			  				$(this).parent().css("height","30px");
			  				$(this).css("height","20px");
			  				$(this).parent().find(' .faceDiv').css("display","none");
			  			}
			  		});
		  	     $('div[name=main-pl] div.Input_text').unbind('focus').bind('focus',function(){
		 			$(this).parent().css("height","110px");
		 			$(this).css("height","60px");
		 			$(this).parent().find(' #btnpl').css("display","block");
		 			});
		  	     
		  	   $('a[name=pinglun]').unbind('click').bind('click',function(event){
		  		 if($(this).find('span').text()=='评论'){
		  			 $(this).parent().next().find('.Input_text').focus();
		  		   }
		  		 else if($(this).find('span').attr('name')=='dianzan'){
		  			 var id=$(this).parent().parent().attr('data-id');
		  			 var $the_target=$(this);
		  			 if($(this).find('span').attr('data-operate')=='0'){
			  				$.ajax({
			  					url:'/WDDXSERVER/targetsquare/thumbsUpShare',
			  				    data:{userid:user_id,s_id:id,state:'1',ticket:ticket},
			  				    type:'post'
			  				}).done(function(data){
			  						if(data.content.message==true){
			  							$the_target.find('span').text('取消赞 ('+(parseInt($the_target.find('span').text().match(/\d+/g))+1)+')');
			  							$the_target.find('span').attr('data-operate','1');
					  			        var $the_id_dom=$the_target.parents('div[name=onejl]');
					  			      $('div[name=dianzan_object_'+$the_id_dom.attr('data-id')+']').css('display','block');
					  			      $('div[name=dianzan_object_'+$the_id_dom.attr('data-id')+'] img.zan_sign').after('<img data-bz="myself_dianzan" src="'+user_img+'" >');
					  			      if(parseInt($the_target.find('span').text().match(/\d+/g))>6)
						  				 $('div[name=dianzan_object_'+$the_id_dom.attr('data-id')+'] span').text('共'+parseInt($the_target.find('span').text().match(/\d+/g))+'人点赞');
			  						}
			  						else
			  						   win.alert('系统提醒','失败，请稍后操作');
			  				});
			  			    
			  			 }
			  			 else{

			  				$.ajax({
			  					url:'/WDDXSERVER/targetsquare/thumbsUpShare',
			  				    data:{userid:user_id,s_id:id,state:'-1',ticket:ticket},
			  				    type:'post'
			  				}).done(function(data){
			  					if(data.content.message==true){
			  						$the_target.find('span').text('点赞 ('+(parseInt($the_target.find('span').text().match(/\d+/g))-1)+')');
			  				       $the_target.find('span').attr('data-operate','0');
			  				       if(parseInt($the_target.find('span').text().match(/\d+/g))==0)
				  				     $('div[name=dianzan_object_'+$the_target.parents('div[name=onejl]').attr('data-id')+']').css('display','none');
			  				       if(parseInt($the_target.find('span').text().match(/\d+/g))>6)
				  				      $('div[name=dianzan_object_'+$the_target.parents('div[name=onejl]').attr('data-id')+'] span').text('共'+parseInt($the_target.find('span').text().match(/\d+/g))+'人点赞');
			  				       $('div[name=dianzan_object_'+$the_target.parents('div[name=onejl]').attr('data-id')+'] img[data-bz=myself_dianzan]').remove();
			  					}else
			  						   win.alert('系统提醒','失败，请稍后操作');
			  					});
			  			 }
		  		/*	 if($(this).find('span').attr('data-operate')=='0'){
		  			      operate_zan({userid:user_id,s_id:id,state:'1'});
		  			      $(this).find('span').text('取消赞 ('+(parseInt($(this).find('span').text().match(/\d+/g))+1)+')');
		  			      $(this).find('span').attr('data-operate','1');
		  			      var $the_id_dom=$(this).parents('div[name=onejl]');
		  			      $('div[name=dianzan_object_'+$the_id_dom.attr('data-id')+']').css('display','block');
		  			       $('div[name=dianzan_object_'+$the_id_dom.attr('data-id')+'] img.zan_sign').after('<img data-bz="myself_dianzan" src="'+user_img+'" >');
		  			        if(parseInt($(this).find('span').text().match(/\d+/g))>6)
			  				 $('div[name=dianzan_object_'+$the_id_dom.attr('data-id')+'] span').text('共'+parseInt($(this).find('span').text().match(/\d+/g))+'人点赞');
		  			 }
		  			 else{
		  				
		  				$(this).find('span').text('点赞 ('+(parseInt($(this).find('span').text().match(/\d+/g))-1)+')');
		  				 operate_zan({userid:user_id,s_id:id,state:'-1'});
		  				 $(this).find('span').attr('data-operate','0');
		  				 if(parseInt($(this).find('span').text().match(/\d+/g))==0)
			  				 $('div[name=dianzan_object_'+$(this).parents('div[name=onejl]').attr('data-id')+']').css('display','none');
		  				 if(parseInt($(this).find('span').text().match(/\d+/g))>6)
			  				 $('div[name=dianzan_object_'+$(this).parents('div[name=onejl]').attr('data-id')+'] span').text('共'+parseInt($(this).find('span').text().match(/\d+/g))+'人点赞');
		  				 $('div[name=dianzan_object_'+$(this).parents('div[name=onejl]').attr('data-id')+'] img[data-bz=myself_dianzan]').remove();
		  				
		  			 }*/
		  		  }
		  		 else {
		  			var $this_a=$(this).find('span:contains(加入我的目标)');
	  				$.ajax({
	  					url:'/WDDXSERVER/target/addTargetfromSquare',
	  					data:{userid:user_id,ticket:ticket,targetID:$(this).parents('div[name=onejl]').attr('data-target')}
	  				}).done(function(data){
			  			 win.alert("系统提示","已成功添加日常目标！");
			  			 setTimeout(function(){
			  				$('div.win').css('display','none');
			  				$this_a.text('已加入日常目标');
			  				
			  				$this_a.parents('a[name=pinglun]').unbind('click').bind('click',function(){
			  				   $(this).css({'cursor':'default'});
			  				   return false;	
			  				});
			  			},1000);
	  				});	
		  		 }
		  		return false;
		  	});
		  	 if(data[i].zan>0)
		  	    get_dianzan(data[i].id);
		  	 else if(data[i].zan==0)
		  		$('div[name=dianzan_object_'+data[i].id+']').css('display','none');
		  	 get_comments(data[i].id);
		  	//  $(".loaddiv").hide(); 
	  }
	 
	}
});
};
 function get_dianzan(param){
	  $.ajax({
			url:'/WDDXSERVER/targetsquare/getThumbsUp',
		    data:{userid:user_id,s_id:param,ticket:ticket},
		    type:'post'
		 }).done(function(data){
			data = data.content.message;
			 for(var m=0;m<data.length;m++){
  	      		 if(m<=6 && data[m].bs =='1')
  	      			$('div[name=dianzan_object_'+param+']').append('<img data-bz="myself_dianzan" src="'+data[m].path+'" >');
  	      		 else if(m<=6 && data[m].bs =='0')
	      			$('div[name=dianzan_object_'+param+']').append('<img src="'+data[m].path+'" >');
  	      		 else{
  	      			$('div[name=dianzan_object_'+param+']').append('<span>共'+data.length+'人点赞</span>'); 
  	      		    break;	
  	      		 }
  	      	 } 
		 });
 }
 function operate_zan(param){
      $.ajax({
		url:'/WDDXSERVER/targetsquare/thumbsUpShare',
	    data:param,
	    type:'post'
	}).done(function(data){
			return data[0].message;	 
	});
}	
function onmous(a){
	$(a).addClass("active");
}
function onmousout(a){
	$(a).removeClass("active");
}
function onmous1(a){
	$(a).addClass("active1");
}
function onmousout1(a){
	$(a).removeClass("active1");
}
</script>

</body>
</html>
